package com.ecb.business.remote.chainmaker;

import com.alibaba.fastjson.JSON;
import com.dtflys.forest.annotation.*;
import com.ecb.business.dto.api.ChainMakerRemoteResult;

import java.util.Map;


/**
 * @author:wtlu
 * @Despriction:
 * @Date: Created in 2024/10/5 15:39
 * @Modify By: wtlu
 */

public interface ChainMakerRemote {


    @Post(url = "http://${baseUrl}/chainmaker")
    String getChainDetail(@Var("baseUrl") String chainMakerUrl, @Header String token,  @Query String cmb, @JSONBody Map bodyMap);

    default ChainMakerRemoteResult parse(String result) {
        final ChainMakerRemoteResult cmResult = JSON.parseObject(result, ChainMakerRemoteResult.class);
        cmResult.setOriginTxt(result);
        return cmResult;
    }
}

//{
//    "Response": {
//        "Data": {
//            "Id": 1,
//            "ChainId": "testbc",
//            "ChainName": "测试一",
//            "Version": "v2.3.1",
//            "Sequence": "0",
//            "BlockTxCapacity": 100,
//            "TxTimeout": 600,
//            "BlockInterval": 10,
//            "DockerVm": 0,
//            "ChainMode": "permissionedWithCert",
//            "Consensus": 1
//        }
//    }
//}